namespace Game.Networking.Server {
	public sealed class ServerDebugController : ServerSideController<ServerDebugController> {
		public ServerDebugController(ServerGameManager owner) : base(owner) {
		}

		uint _watchedUnitId;
		DebugUnitEventsWatcher _debugWatcher = new DebugUnitEventsWatcher();
		public uint WatchedUnitId => _watchedUnitId;

		public DebugUnitEventsWatcher DebugUnitWatcher => _debugWatcher;

		public void SetWatchedComputingUnitId(uint unitId) {
			_debugWatcher.DeInit();
			var unit = ServerScriptController.Instance.GetUnitById(unitId);
			_debugWatcher.Setup(unit);
			_watchedUnitId= unitId;
			var e = ServerEntityController.Instance.GetEntityById(unit.Data.AttachedEntity);
			if ( e != null) {
				var s = (ShipCore)e;
				SpectatorCamera.Instance.ConfineTarget = s.transform;
				SpectatorCamera.Instance.CenterToTarget();
			}
		}
	}
}